#region Using

using System;
using System.Xml;
using System.IO;
using System.Globalization;
using System.Collections.Generic;
using System.Collections.Specialized;
using BlogEngine.Core;
using BlogEngine.Core.Provider.Interfaces;

#endregion

namespace BlogEngine.Core.Provider.XML
{
	/// <summary>
	/// A storage provider for BlogEngine that uses XML files.
	/// <remarks>
	/// To build another provider, you can just copy and modify
	/// this one. Then add it to the web.config's BlogEngine section.
	/// </remarks>
	/// </summary>
	public class CIPostContent : IPostContent
	{
		/// <summary>
		/// Retrieves the content of the post in order to lazy load.
		/// </summary>
		/// <param name="id"></param>
		/// <returns></returns>
        public string SelectPostContent(Guid id)
        {
			string fileName = Provider.Folder + "posts" + Path.DirectorySeparatorChar + id.ToString() + ".xml";
			XmlDocument doc = new XmlDocument();
			doc.Load(fileName);

			return doc.SelectSingleNode("post/content").InnerText;
        }
    }
}